﻿package net.pezzato.genetree.graphics{
	import net.pezzato.graphics.Window;
	import net.pezzato.graphics.Widget;
	import net.pezzato.graphics.TextInputLabel;
	import net.pezzato.localization.Translator;
	import fl.controls.TextInput;
	import fl.controls.Label;
	import fl.controls.Button;
	import flash.events.MouseEvent;
	import flash.events.Event;
	public class SelectIdWindow extends Window{
		public static const ID_SELECTED:String = "SelectIdWindow: id selected";
		private var tiId_:TextInput;
		public function SelectIdWindow(wp:Widget) {
			super(wp, Translator.translate("selectId"), 0, 0, 300, 150);
			/* input id */
			tiId_ = new TextInput();
			//tiId_.y = topMargin.y;
			toTop(tiId_);
			tiId_.x = 80;
			addChild(tiId_);
			/* label id */
			var labelId:TextInputLabel = new TextInputLabel("id:", tiId_);
			addChild(labelId);
			/* button id */
			var btnId:Button = new Button();
			btnId.label = Translator.translate("go");
			btnId.width = 40;
			btnId.addEventListener(MouseEvent.CLICK, onBtnIdClick);
			move(btnId, "leftOf", tiId_, 5);
			addChild(btnId);
		}
		public function get selectedId() {
			return tiId_.text;
		}
		private function onBtnIdClick(event:MouseEvent) {
			dispatchEvent(new Event(ID_SELECTED));
			close();
		}
	}
}